&sizes[i].minimum_size, &sizes[i].natural_size,
NULL, NULL);
- /* Assert the api is working properly */
- if (sizes[i].minimum_size < 0)
- g_error ("GtkBox child %s minimum %s: %d < 0 for %s %d",
- gtk_widget_get_name (GTK_WIDGET (child->widget)),
- (private->orientation == GTK_ORIENTATION_HORIZONTAL) ? "width" : "height",
- sizes[i].minimum_size,
- (private->orientation == GTK_ORIENTATION_HORIZONTAL) ? "height" : "width",
- (private->orientation == GTK_ORIENTATION_HORIZONTAL) ? allocation->height : allocation->width);
-
- if (sizes[i].natural_size < sizes[i].minimum_size)
- g_error ("GtkBox child %s natural %s: %d < minimum %d for %s %d",
- gtk_widget_get_name (GTK_WIDGET (child->widget)),
- (private->orientation == GTK_ORIENTATION_HORIZONTAL) ? "width" : "height",
- sizes[i].natural_size,
- sizes[i].minimum_size,
- (private->orientation == GTK_ORIENTATION_HORIZONTAL) ? "height" : "width",
- (private->orientation == GTK_ORIENTATION_HORIZONTAL) ? allocation->height : allocation->width);
-
children_minimum_size += sizes[i].minimum_size;
sizes[i].data = child;
&sizes[i].minimum_size, &sizes[i].natural_size,
NULL, NULL);
- /* Assert the api is working properly */
- if (sizes[i].minimum_size < 0)
- g_error ("GtkBox child %s minimum %s: %d < 0",
- gtk_widget_get_name (GTK_WIDGET (child->widget)),
- (private->orientation == GTK_ORIENTATION_HORIZONTAL) ? "width" : "height",
- sizes[i].minimum_size);
-
- if (sizes[i].natural_size < sizes[i].minimum_size)
- g_error ("GtkBox child %s natural %s: %d < minimum %d",
- gtk_widget_get_name (GTK_WIDGET (child->widget)),
- (private->orientation == GTK_ORIENTATION_HORIZONTAL) ? "width" : "height",
- sizes[i].natural_size,
- sizes[i].minimum_size);
-
children_minimum_size += sizes[i].minimum_size;
sizes[i].data = child;
G_OBJECT_TYPE_NAME (widget), widget, min_size, nat_size, for_size);
}
+
+ nat_size = min_size;
+ }
+ else if (G_UNLIKELY (min_size < 0))
+ {
+ g_warning ("%s %p reported min %s %d, but sizes must be >= 0",
+ G_OBJECT_TYPE_NAME (widget), widget,
+ orientation == GTK_ORIENTATION_HORIZONTAL ? "width" : "height",
+ min_size);
+ min_size = 0;
+ nat_size = MAX (0, min_size);
}
adjusted_min = min_size;